package com.xbongbong.paas.service.field;

import com.alibaba.fastjson.JSONObject;
import com.xbongbong.paas.domain.entity.PaasFormDataEntity;
import com.xbongbong.paas.enums.FieldTypeEnum;
import com.xbongbong.paas.field.FieldAttrEntity;
import com.xbongbong.paas.toolbox.exception.XbbException;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * @author 吴峰
 * @date 2022/04/01 9:56
 */
@Service("addressAnalysisHandlerImpl")
public class AddressAnalysisHandlerImpl extends AbstractFieldAnalysisHandler {


    @Override
    public List<Integer> fieldType() {
        return Arrays.asList(FieldTypeEnum.ADDRESS.getType());
    }


    @Override
    public Object getValue(FieldAttrEntity fieldAttrEntity, PaasFormDataEntity paasFormDataEntity, JSONObject data, FieldAnalysisPoJo fieldAnalysisPoJo) throws XbbException {
        return data.get(fieldAttrEntity.getAttr());
    }
}
